package br.com.redefranciscanas.wiki.persistence;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceException;

import br.com.redefranciscanas.wiki.util.PersistenceUtil;

public abstract class Dao {

	private EntityManager session;
	private EntityTransaction transaction;

	public Dao() {
		try {
			session = PersistenceUtil.getEntityManager();
		} catch (PersistenceException e) {
			System.out.println("Erro ao criar sessão: " + e);
		}
	}

	public EntityManager getSession() {
		return session;
	}

	public void setSession(EntityManager session) {
		this.session = session;
	}

	public EntityTransaction getTransaction() {
		return transaction;
	}

	public void setTransaction(EntityTransaction transaction) {
		this.transaction = transaction;
	} 
}
